import { getUrl } from '../util/wx-mini'

let systemData: any = {}


function getSystemData() {
  if (systemData.os) {
    systemData.pageurl = getUrl();
    return systemData
  };
  try {
    const res: any = wx.getSystemInfoSync()
    systemData.md = res.model
    systemData.version = res.version
    systemData.cl = res.system
    systemData.uhw = res.windowHeight + '*' + res.windowWidth
    systemData.os = res.platform
  } catch (e) {
    console.error('getSystemData', e)
  }
  return systemData;
}
export default getSystemData;